const Router=require('koa-router');

const router=new Router();

router.post('/login',(ctx)=>{
  let {username,password}=ctx.request.body;
  if(username==="xiaoming" && password==="123"){
    ctx.body={
      code:"0",
      message:"欢迎管理员",
      token:"123",
      info:{
        user:"小明",
        roles:"admin",
        dynamicRoutes:[
          {
            path: "/test1",
            layout: "dashboard",
            meta:{
              title: "获取下拉菜单",
              icon: "VideoCameraOutlined",
            },
            children:[
              {
                path:"/test",
                meta:{
                  title: '获取测试',
                  icon: 'ExperimentOutlined',
                },
                component:"/test/Test"
              }
            ]
          }
        ]
      }
    };
    return;
  }
  ctx.body={
    code:"-2",
    message:"用户名或密码错误请重新登录"
  };


});

module.exports=router;
